package com.at.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 *
 * @author cdhuangchao3
 * @date 2023/3/19 9:52 PM
 */
object Spark05_RDD_glom {

  def main(args: Array[String]): Unit = {
    // 环境准备
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    val sc = new SparkContext(sparkConf)

    // TODO 算子 - glom
    val rdd : RDD[Int] = sc.makeRDD(List(1,2,3,4), 2)

    val mapRDD: RDD[Array[Int]] = rdd.glom()

    mapRDD.collect().foreach(data => println(data.mkString(",")))

    sc.stop()
  }

}
